<template>
	<view class="scroll-list-container">
		<view>
			<slot></slot>
		</view>
		<template v-if="showStatus">
			<template v-if="isLoading">
				<view class="tips-text">正在加载</view>
			</template>
			<template v-else>
				<u-empty v-if="!list.length" icon="/static/empty.png" />
				<view v-else-if="isNext" class="tips-text">已加载全部</view>
			</template>
		</template>
	</view>
</template>

<script>
	export default {
		props: {
			showStatus: {
				type: Boolean,
				default: true,
			},
			total: {
				type: Number,
				default: 0,
			},
			queryParams: {
				type: Object,
				default: () => ({
					current: 0,
					size: 0,
				})
			},
			isLoading: {
				type: Boolean,
				default: false,
			},
			list: {
				type: Array,
				default: () => ([]),
			}
		},
		computed: {
			isNext() {
				return this.queryParams.current * this.queryParams.size >= this.total;
			}
		}
	}
</script>

<style scoped lang="scss">
	.scroll-list-container {
		.tips-text {
			padding-top: 50rpx;
			text-align: center;
			font-size: 30rpx;
			color: #999;
		}
	}
</style>